import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';

// 函数式组件
function FirstPro(params) {
  console.log(params)
  let title = <h2>我是副标题</h2>
  return (
    <div>
      <h1>helloworld{params.weather == "下雨" ? "不出门" : "出门"}</h1>
      {title}
      {/* <HelloWorld/> */}
    </div>
  )
}

// 类组件
class HelloWorld extends React.Component {
  render() {
    console.log(this)
    return (
      <div>
        <h1>类组件helloworld</h1>
        <FirstPro weather={this.props.weather} />
      </div>
    )
  }
}

ReactDOM.render(
  <HelloWorld weather="下雨" />,
  document.getElementById('root')
)
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
